import Vue from "vue";
import VueRouter from "vue-router";
import HomeView from "../views/HomeView.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "home",
    component: HomeView,
  },
  {
    path: "/about",
    name: "about",
    component: () => import("../views/AboutView.vue"),
    children: [
      {
        path: "js",
        name: "js",
        component: () => import("../views/JsPage.vue"),
      },
      //不加/ 在跳转到这个路径的时候要拼上他的父级/about
      {
        path: "/php",
        name: "php",
        component: () => import("../views/PhpPage.vue"),
      },
      //加了/用的时候直接就是/php 不用再拼父级路径
    ],
  },
  // {
  //   path: "/js",
  //   name: "js",
  //   component: () => import("../views/JsPage.vue"),
  // },
  // {
  //   path: "/php",
  //   name: "php",
  //   component: () => import("../views/PhpPage.vue"),
  // },
];

const router = new VueRouter({
  routes,
});

export default router;
